<template>
	<view class="page">
		<free-nav-bar title="设置" showBack :showRight="false"></free-nav-bar>
		
		
		<!-- 退出登录按钮 -->
		<free-divider></free-divider>
		<view class="py-3 flex align-center justify-center bg-white" hover-class="bg-light" 
		@click="logout">
			<text class="font-md text-primary">退出登录</text>
		</view>
	</view>
</template>

<script>
	import $H from '@/common/free-lib/request.js';
	import freeNavBar from "@/components/free-ui/free-nav-bar.vue"
	import freeDivider from "@/components/free-ui/free-divider.vue"
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			logout(){
				uni.showModal({
					title: '提示',
					content: '确认退出登录吗？',
					success: res => {
						if(res.confirm){
							$H.post('/logout').then(res=>{
								uni,uni.showToast({
									title: '退出登录成功',
									icon: 'none'
								});
								this.$store.dispatch('logout')
							})
						}
					},
				});
			}
		},
		components:{
			freeNavBar,
			freeDivider
		}
	}
</script>

<style>

</style>
